﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MINERP.BLL.LeaderOperate;

namespace MINERP.LeaderOperate
{
    public partial class FrmGroupEmployment : Form
    {
        private int _userId;

        LeaderTaskBLL _bll = new LeaderTaskBLL();

        public FrmGroupEmployment(int userId)
        {
            InitializeComponent();
            _userId = userId;
            
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            try
            {
                DateTime start = dtStart.DateTime;
                DateTime end = dtEnd.DateTime.AddDays(1).Date.AddSeconds(-1);
                this.Cursor = Cursors.WaitCursor;
                DataTable dt = _bll.GetGroupEmployment(_userId, start, end);
                if (dt.Rows.Count > 0)
                {
                    gcEmployeePerformance.DataSource = dt;
                    gcEmployeePerformance.RefreshDataSource();
                }
                else
                {
                    MessageBox.Show("暂时还没记录！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
                Cursor = Cursors.Default;  
            }

        }

        private void FrmGroupEmployment_Load(object sender, EventArgs e)
        {
            dtStart.DateTime = DateTime.Now.Date;
            dtEnd.DateTime = DateTime.Now.AddDays(1).Date.AddSeconds(-1);
        }
    }
}
